package cn.fundview.eureka.client.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zhuot on 2017/5/20.
 */
@RestController
public class IndexController {

    @Value("${words}")
    private String words;

    @RequestMapping("/index")
    public String index() {
        String[] wordArray = words.split(",");
        int i = (int) Math.round(Math.random() * (wordArray.length - 1));
        return wordArray[i];
    }
}
